@import '~antd/es/style/themes/default.less';
@import '~@/styles/variable.less';

@font-face {
  font-family: 'Source Code Pro';
  src: url('../assets/fonts/SourceCodePro-Regular.ttf.woff2') format('woff2'),
    url('../assets/fonts/SourceCodePro-Regular.otf.woff') format('woff'),
    url('../assets/fonts/SourceCodePro-Regular.ttf') format('truetype');
}

body {
  // 禁止手机页面下拉刷新
  overflow: hidden;

  // 禁止手机页面弹簧效果
  position: fixed;
  top: 0;
  left: 0;
}

#root {
  height: 100vh;
  height: calc(100vh - var(--vh-offset, 0px));
  -webkit-overflow-scrolling: touch;
}

.ant-modal-header {
  padding-right: 54px;
}

.ant-modal-body {
  max-height: calc(80vh - 110px);
  max-height: calc(80vh - var(--vh-offset, 110px));
  overflow-y: auto;
}

.log-modal {
  &.ant-modal {
    max-width: 1000px !important;
    width: 80vw !important;
  }

  .ant-modal-body {
    overflow-y: auto;
    min-height: 300px;
    max-height: calc(80vh - 110px);
    max-height: calc(80vh - var(--vh-offset, 110px));
    padding: 0;
    display: flex;

    .log-container {
      width: 100%;
      padding: 24px;
      overflow-y: auto;
    }
  }

  pre {
    white-space: break-spaces;
    line-height: 17px;
    margin-bottom: 0;
    overflow: hidden;
  }
}

.monaco-editor:not(.rename-box) {
  height: calc(100vh - 128px) !important;
  height: calc(100vh - var(--vh-offset, 0px) - 128px) !important;

  .view-overlays .current-line {
    border-width: 0;
  }
}

.rename-box {
  height: 0;

  .rename-input {
    height: 0;
    padding: 0 !important;
    display: none !important;
  }
}

.ant-pro-grid-content.wide {
  max-width: unset !important;
  overflow: auto;

  .ant-pro-page-container-children-content {
    overflow: auto;
    height: 100%;
    background-color: @component-background;
    padding: 12px;
  }
}

.ql-container-wrapper-has-tab {
  .ant-pro-grid-content.wide .ant-pro-page-container-children-content {
    padding-top: 0;
  }
}

.ant-table-cell-ellipsis {
  text-align: left !important;
}

.ant-tooltip {
  max-width: 300px !important;

  .ant-tooltip-inner {
    word-break: break-all !important;
    max-height: 300px !important;
    overflow-y: auto !important;
  }
}

.env-wrapper {
  th {
    white-space: nowrap;
  }
}

.log-wrapper {
  .log-select {
    width: 250px;
  }

  .ant-page-header-heading-left {
    min-width: 100px;
  }
}

.config-wrapper {
  .config-select {
    width: 250px;
  }

  .ant-page-header-heading-left {
    min-width: 100px;
  }
}

.ant-tree {
  .ant-tree-treenode {
    width: 100%;
    padding-right: 8px !important;
  }

  .ant-tree-node-content-wrapper {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
  }
}

.ant-select-tree {
  .ant-select-tree-treenode {
    width: 100%;
    padding-right: 8px !important;
  }

  .ant-select-tree-node-content-wrapper {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
  }
}

.ant-pro-page-container.ql-container-wrapper {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 48px);
  height: calc(100vh - var(--vh-offset, 0px) - 48px);

  .ant-pro-grid-content.wide {
    flex: 1;

    .ant-pro-grid-content-children {
      height: 100%;

      > div,
      .log-container,
      .react-codemirror2,
      .CodeMirror {
        height: 100%;
        overflow: auto;
      }
    }
  }
}

@media (max-width: 768px) {
  .ql-container-wrapper {
    &.crontab-wrapper,
    &.log-wrapper,
    &.env-wrapper,
    &.config-wrapper {
      .CodeMirror {
        width: calc(100vw - 24px);
      }
    }
  }

  .log-modal {
    &.ant-modal {
      width: calc(100vw - 16px) !important;
    }
  }

  .ant-tooltip {
    max-width: 300px !important;
  }
}

.ant-layout-content.ant-pro-basicLayout-content.ant-pro-basicLayout-has-header {
  margin-bottom: 0 !important;
  min-height: calc(100vh - 72px);
  min-height: calc(100vh - var(--vh-offset, 0px) - 72px);
}

.Resizer {
  background: @component-background;
  opacity: 0.8;
  z-index: 100;
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  -moz-background-clip: padding;
  -webkit-background-clip: padding;
  background-clip: padding-box;
  border-left: 5px solid rgba(42, 161, 255, 0);
  border-right: 5px solid rgba(42, 161, 255, 0);
}

.Resizer:hover {
  -webkit-transition: all 2s ease;
  transition: all 2s ease;
}

.Resizer.horizontal {
  height: 11px;
  margin: -5px 0;
  cursor: row-resize;
  width: 100%;
}

.Resizer.vertical {
  width: 11px;
  margin: 0 -5px;
  cursor: col-resize;
}

.Resizer.horizontal:hover,
.Resizer.vertical:hover {
  border-left-color: rgba(42, 161, 255, 0.5);
  border-right-color: rgba(42, 161, 255, 0.5);
}

.Resizer.disabled {
  cursor: not-allowed;
}

.Resizer.disabled:hover {
  border-color: transparent;
}

.edit-modal {
  .ant-drawer-body {
    padding: 0;
  }
}

.inline-countdown.ant-statistic {
  display: inline-block;

  .ant-statistic-content {
    font-size: 14px;
    padding: 0 3px;
  }
}

.ant-form-item-extra {
  word-break: break-all;
  font-size: 13px;
}

/* Change autocomplete styles in WebKit */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
  box-shadow: none;
  transition: background-color 5000s ease-in-out 0s;
  -webkit-text-fill-color: @text-color;
  caret-color: @text-color;
  color: @text-color;
}

::placeholder {
  opacity: 0.5 !important;
}

.ant-select-selection-placeholder {
  opacity: 0.5 !important;
}

.ant-pro-basicLayout-content {
  margin: 12px;

  .ant-pro-page-container {
    margin: -12px;
  }

  .ant-pro-page-container-warp .ant-page-header {
    border-bottom: 1px solid #eee;
  }

  .ant-pro-page-container-children-content {
    margin: 0;
  }
}

.ant-pro-global-header {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.03);
}

.ant-menu-item.ant-pro-sider-collapsed-button {
  margin: 0;
}

.side-menu-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: @text-color;

  .side-menu-collapse-button:hover {
    color: #1890ff;
  }

  .side-menu-user-wrapper {
    display: flex;
    align-items: center;
  }
}

.side-menu-user-drop-menu {
  position: relative;
  text-align: left;
  padding: 2px 10px;
  overflow: auto;
}

.ant-pro-sider-logo {
  padding-inline: 5px !important;

  .title {
    display: flex;
    height: 32px;
    margin: 0 5px;
    font-weight: 600;
    font-size: 16px;
    line-height: 32px;
    vertical-align: middle;
    animation: pro-layout-title-hide 0.3s;

    a {
      display: inline-flex;
      align-items: center;
    }
  }

  img {
    width: 32px !important;
    border-radius: 52% !important;
  }
}

.ant-pro-global-header-logo {
  a img {
    // 移动端logo被拉伸
    width: auto !important;
  }

  .ant-image {
    display: inline-flex;
  }
}

pre {
  word-break: break-all;
  white-space: break-spaces;
  padding: 0;
}

.virtuallist {
  .ant-table-tbody > tr > td > div {
    white-space: unset !important;
  }
}

.virtuallist .ant-table-tbody > tr > td > div {
  box-sizing: border-box;
  white-space: nowrap;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.virtuallist .ant-table-tbody > tr > td.ant-table-row-expand-icon-cell > div {
  overflow: inherit;
}

.ant-table-bordered .virtuallist > table > .ant-table-tbody > tr > td {
  border-right: 1px solid #f0f0f0;
}

.ant-table-column-title {
  flex: unset;
}

.ant-table-column-sorters,
.ant-table-filter-column {
  justify-content: unset;
}

textarea.ant-input {
  word-break: break-all;
}

.ant-pro-sider-collapsed,
body[data-mode='phone'] header {
  .title {
    display: none;
  }
}

.ant-design-pro .ant-pro-sider.ant-layout-sider.ant-pro-sider-fixed {
  box-shadow: none;
  border-right: 1px solid #eee;
}

.ant-table.ant-table-middle .ant-table-title,
.ant-table.ant-table-middle .ant-table-footer,
.ant-table.ant-table-middle .ant-table-thead > tr > th,
.ant-table.ant-table-middle .ant-table-tbody > tr > td,
.ant-table.ant-table-middle tfoot > tr > th,
.ant-table.ant-table-middle tfoot > tr > td {
  padding: 12px 16px;
}

body[data-dark='true'] {
  .ant-popover-arrow-content {
    --antd-arrow-background-color: rgb(24, 26, 27);
  }
}

.ant-tabs-content-holder {
  flex: 1;
  overflow-y: auto;
}
